import { ref } from "vue";
let commandComponent = ref(null)

function init() {
    const pages = getCurrentPages();
    const currentPage = pages[pages.length - 1];

    commandComponent.value = currentPage.selectComponent('#my-bindPhoneNumber').$vm;

    // #ifdef H5 || APP-PLUS
    // commandComponent.value = currentPage.$refs.myBindPhoneNumberRef
    // #endif
    if (!commandComponent.value) {
        console.warn('未找到 my-bind-phone-number 节点，请确认 selector 及 context 是否正确');
        return false
    }
    return true
}

const bingPhone = {
    showBingPhone() {
        init() && commandComponent.value.showBingPhone();
    }
}

export default bingPhone